from django.http import response
from django.shortcuts import redirect
from django.utils.deprecation import MiddlewareMixin
from django.urls import reverse


class MD1(MiddlewareMixin):
    def process_request(self, request):
        if not (request.path.startswith('/login/') or request.path.startswith('/api/')):
            if not request.session.get("is_login"):
                print(request.path)
                return redirect('/api/Worker/login/')
